package com.example.Lezedata.ui.activity.common;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.Lezedata.R;
import com.example.Lezedata.ui.activity.baseClass.GBBaseVc;
import com.example.Lezedata.util.CGHUDView;

public class GBErrorView extends LinearLayout {
    private ViewGroup viewGroup;
    public TextView tipTextView;
    public TextView back;
    public GBErrorView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public static GBErrorView showInView(Context context, ViewGroup parentView) {
        GBErrorView fragment = (GBErrorView) LayoutInflater.from(context).inflate(R.layout.err_view,parentView,false);
        fragment.viewGroup = parentView;
        parentView.addView(fragment);
        return fragment;
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        tipTextView = findViewWithTag("text");
        back = findViewWithTag("back");
        back.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ((GBBaseVc)getContext()).finish();
            }
        });
    }
}
